import requests

url = 'https://weibo.com/a/hot/realtime'
headers = {'user-agent':'Mozilla/5.0','cookie':r'SUB=_2AkMoXJEcf8NxqwJRmP4RzWzjboh3wwDEieKeAGDHJRMxHRl-yT9kqhM8tRB6A9y_85TkCIjYCpHzRW07HF5r3w0zT8SQ; SUBP=0033WrSXqPxfM72-Ws9jqgMF55529P9D9WW-KcB8qZsAZbjvl-Qpna5a'}

try:
    html = requests.get(url,headers=headers)
except:
    print('获取失败')
with open('爬虫\\weibo.html','wb') as f:
        f.write(html.content)



